package de.fuberlin.inf.alp3.ue02;

import de.fuberlin.inf.alp3.utils.ConsoleInput;

public class TheatreTest {
    public static void main(String[] args) {
        Theatre t = new Theatre(8, 10);

        System.out.println("A new Theatre object has been created.");
        int userInput = -1;
        while (true) {
            System.out.println("  1. Reserve seats");
            System.out.println("  2. Cancel seats");
            System.out.println("  3. Show theatre hall");
            System.out.println("\n  0. Exit application");
            userInput = ConsoleInput.readInt("Your choice?", "Not a number!");
            switch (userInput) {
            case 0:
                System.out.println("Bye...");
                System.exit(0);
            case 1:
                if (t.reserve(
                        ConsoleInput.readChar("Which Row?"),
                        ConsoleInput.readInt("First Seat?", "Not a number!"),
                        ConsoleInput.readInt("Last Seat?", "Not a number!")))
                    System.out.println("Requested seats have been reserved.");
                else
                    System.out.println("No seat has been reserved.");
                break;
            case 2:
                if (t.cancel(
                        ConsoleInput.readChar("Which Row?"),
                        ConsoleInput.readInt("First Seat?", "Not a number!"),
                        ConsoleInput.readInt("Last Seat?", "Not a number!")))
                    System.out.println("Requested seats have been canceled.");
                else
                    System.out.println("No seat has been canceled.");
                break;
            case 3:
                System.out.println(t);
                break;
            default:
                System.out.println("Please choose from available options.");
            }
        }
    }
}